<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>FileDownload</title>
    <style>
        body{
            margin-top: 50px;
            margin-left: 100px;
            margin-right: 100px;
            margin-bottom: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            border: none; /* 移除表格的边框 */
        }
        th, td {
            padding: 8px 12px;
            text-align: left;
            border-top: 1px solid #ddd; /* 只保留顶部边框 */
            border-bottom: 1px solid #ddd; /* 只保留底部边框 */
        }
        th.size, td.size,
        th.date, td.date {
            text-align: right; /* 将大小和日期列的文字靠右对齐 */
            width: 300px; /* 固定大小和日期列的宽度 */
        }
        th {
            background-color: rgb(251 251 251);
            color: rgb(42 215 157);
        }
        a {
            text-decoration: none;
            color: #333;
        }
        a:hover {
            text-decoration: none;
            color: #0036e7;
        }
        .back-link {
            display: inline-block;
            margin-bottom: 10px;
            color: rgb(0, 0, 0);
        }
        .center-text {
            text-align: center;
            font-size: 24px;
            margin-bottom: 20px;
            color: rgb(42 215 157);
        }
    </style>
</head>
<body>
<!-- <h1>Current Directory: {{.CurrentDir}}</h1> -->

<!-- 添加返回上级目录的链接 -->
    <div class="center-text">FileDownload</div>
    <a href="/" class="back-link">Home</a>
    &nbsp;&nbsp;
    <a href="../{{.ParentDir}}" class="back-link">Back</a>

    <table>
        <thead>
            <tr>
                <th>Name</th>
                <th class="size">Size</th>
                <th class="date">CreateTime</th>
            </tr>
        </thead>
        <tbody>
            {{range .Files}}
            <tr>
                <td>
                    {{if .IsDir}}
                    &#128193; <!-- Folder icon -->
                    {{else}}
                    &#128196; <!-- File icon -->
                    {{end}}
                    <a href="/{{.URL}}">{{.Name}}</a>
                </td>
                <td class="size">{{if .IsDir}}-{{else}}{{.Size}}{{end}}</td>
                <td class="date">{{.ModTime}}</td>
            </tr>
            {{end}}
        </tbody>
    </table>
</body>
</html>